using System;
using System.Globalization;

namespace F2Enum.Converters
{
    public class DateTimeConveter : ConverterBase<DateTime>
    {
        public override DateTime Convert(string value)
        {
            DateTime result;
            string DateFormatString =null;
            if (string.IsNullOrEmpty(DateFormatString))
            {
                value = DateTime.ParseExact(value, DateFormatString, CultureInfo.CurrentCulture, DateTimeStyles.None).ToShortDateString();
            }
            if (DateTime.TryParse(value, out result))
                return result;
            throw new InvalidCastException("The Value Format Is Incorrect");
        }
    }
}